
<?php
$datamobile = 'false';
$mobile=false;
$datawidth = '745';
$url = Yii::app()->getRequest()->getHostInfo() . Yii::app()->getRequest()->getBaseUrl() . '?event=' . $event["event_id"];
if (preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"])) {
    $datamobile = 'true';
    $datawidth = '';
    $mobile=true;
}
?>
<div class="event-details">
    <div class="details-container">
        <div class="event-details-header">
            <h1><?php echo $event['main_title']; ?></h1>
            <p><?php echo $event['sub_title']; ?></p>

            <div class="time">
                <p>
                <?php echo date_format(new DateTime($main_event['start_time']), 'h:i A'); ?>, <?php echo date_format(new DateTime($main_event['start_date']), 'd - m , Y'); ?>
                </p>
            </div>
            <div class="address">
                <p>

                    <a  href="#modal-map" data-toggle="modal" data-load-remote="<?php echo Yii::app()->createAbsoluteUrl('site/map', array('address' => $event['address'])); ?>" data-remote-target="#modal-map .modal-body">
                        <?php $locate = $event['location'] . ' , ' . $event['address']; ?>
                        <?php echo $locate; ?>
                    </a>
                </p>

            </div>
            <div class="fb-like-container clearfix ">
                <iframe src="//www.facebook.com/plugins/like.php?href=<?php echo $url; ?>&amp;width&amp;layout=button_count&amp;action=like&amp;show_faces=true&amp;share=true&amp;height=21&amp;width=0" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;width:145px;float:right" allowTransparency="true"></iframe>

            </div>
        </div>
        <div class="view-item">

            
            <?php if (isset($event['sub_title1']) && $event['sub_title1'] != null) : ?>
                <p ><?php echo $event['sub_title1']; ?></p>
            <?php endif; ?>
            <?php if (isset($event['sub_title2']) && $event['sub_title2'] != null) : ?>
                <p ><?php echo $event['sub_title2']; ?></p>
            <?php endif; ?>
            <div class="slides-container">

                <div id="slides">
                    <?php foreach ($gallery['items'] as $value) : ?>
                        <?php if($value['active_status'] == 0){ ?>
                        <img src="<?php echo Yii::app()->baseUrl; ?>/timthumb.php?src=<?php echo Yii::app()->baseUrl; ?>/data/image/event/<?php echo $value['name']; ?>&h=400&w=600" alt="slide 1"/>
                        <?php } ?>
                    <?php endforeach; ?>
                </div>
            </div>

            <!-- <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">


                <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
                    <span class="icon new-icon-back"></span>
                </a>
                <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
                    <span class="icon new-icon-next"></span>
                </a>
            </div> -->
            <div class="line"></div>

             <?php if($mobile){?>
                <iframe id="mobile-facebook" class="pull-left" src="//www.facebook.com/plugins/like.php?href=<?php echo $url; ?>&amp;width&amp;layout=button_count&amp;action=like&amp;show_faces=true&amp;share=true&amp;height=21&amp;width=0" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;width:145px;" allowTransparency="true"></iframe>
                <?php } ?>
                <div class="clearfix"></div>
            <div class="bt-item line">

                <div class="num-people pull-left">
                    <p>
                        <?php $num_friend = MyFunctionCustom::CheckFriendBookedFb($event['event_id']); ?>
                        <?php if (!isset(Yii::app()->session['LOGGED_USER'])): ?>
                            <?php echo Yii::t('lang', 'text_login'); ?>
                        <?php else : ?>
                            <?php if ($num_friend > 0) : ?>
                                <a  ref="<?php echo Yii::app()->createAbsoluteUrl('site/loadfriendfb', array('tichket' => $event['event_id'])); ?>"  class="ajax-modal" login="facebook_avata" href="#">
                                    <span style="color: #fc8825" class=""><?php echo $num_friend; ?></span>
                                </a>
                                <?php echo Yii::t('lang', 'friend_booked'); ?>
                            <?php else : ?>



<!--                                <span style="color: #fc8825" class=""><?php echo $num_friend; ?></span>-->
                                <?php echo Yii::t('lang', 'friend_booked'); ?>
                            <?php endif; ?>
                        <?php endif; ?>
                    </p>
<!--                    <p><span style="color: #fc8825"> 30 </span> <?php echo Yii::t('lang', 'celebrity') ?> </p>-->
                </div>
                <!-- Modal Login -->
                <div class="modal " id="Modal-login" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content login-modal">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/frontend/images/icon_close.png" /></button>
                            </div>
                            <div class="modal-body">

                                <!-- <div class="text_info">

                                </div> -->
                            </div>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
                <div class="pull-right">
                    <?php if ($main_event['tickets'] != null) : ?>
                        <div id="require_book">
                            <?php if (!isset(Yii::app()->session['LOGGED_USER'])): ?>
                                <a onclick="login()" style="cursor:pointer" class="book-disable">
                                    <?php echo Yii::t('lang', 'book') ?>
                                </a>
                                <div class="clearfix"></div>
                                <p style="font-size:12px;padding-top:5px;font-weight: bold;">
                                    <?php echo Yii::t('lang', 'require_login'); ?>
                                </p>
                            <?php endif; ?>
                            <?php if (Yii::app()->session['LOGGED_USER'] != null && Yii::app()->session['LOGGED_USER']->role_id == 0): ?>
                                <?php
                                date_default_timezone_set('UTC');
                                $date = $main_event['start_date'] . ' ' . $main_event['start_time'];
                                $quantity = null;
                                foreach ($main_event['tickets'] as $key => $value) {
                                    $real_quantity = MyFunctionCustom::remain_quantity(null,$value->temp_quantity,$value->remain_quantity);
                                    $quantity += $real_quantity;
                                    if ($quantity > 0) {
                                        $result = true;
                                    } else
                                        $result = false;
                                }
                                ?>
                                <?php if ($result == true && $date > date('Y-m-d', time())) : ?>
                                    <a href="#Modal-book" data-toggle="modal" data-load-remote="<?php echo Yii::app()->createAbsoluteUrl('site/booked', array('id' => $event['id'])); ?>" data-remote-target="#Modal-book .modal-body" class="book">
                                        <?php echo Yii::t('lang', 'book') ?>
                                    </a>
                                <?php else : ?>
                                    <a href="#" style="cursor:not-allowed" class="book-disable">
                                        <?php echo Yii::t('lang', 'book') ?>
                                    </a>
                                    <div class="clearfix"></div>
                                    <p style="font-size:12px;padding-top:5px;font-weight:bold">
                                        <?php echo $event['text_contact']; ?>
                                    </p>
                                <?php endif; ?>
                            <?php endif; ?>
                        </div>
                    <?php else : ?>

                        <a href="#" style="cursor:not-allowed" class="book-disable">
                            <?php echo Yii::t('lang', 'book') ?>
                        </a>
                        <div class="clearfix"></div>
                        <p style="font-size:12px;padding-top:5px;font-weight:bold">
                            <?php if ($event['text_contact'] == NULL) : ?>
                                Delay / Contact
                            <?php else : ?>
                                <?php echo $event['text_contact']; ?>
                            <?php endif; ?>
                        </p>

                    <?php endif; ?>
                    <a href="#Modal-book" data-toggle="modal" data-load-remote="<?php echo Yii::app()->createAbsoluteUrl('site/booked', array('id' => $event['id'])); ?>" data-remote-target="#Modal-book .modal-body" class="book">
                        <?php echo Yii::t('lang', 'book') ?>
                    </a>
                </div>
            </div>
            <div class="modal " id="Modal-book" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content booked-modal">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/frontend/images/icon_close.png" /></button>
                        </div>
                        <div class="modal-body">

                            <!-- <div class="text_info">

                            </div> -->
                        </div>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->

            <div class="text_info">

                <?php echo $event['description']; ?>
            </div>
            <?php if ($main_event['video_link'] != null) : ?>
                <p class="line"></p>
                <div >
                    <div class="popup_video">
                        <iframe class="video" src="http://www.youtube.com/embed/<?php echo $main_event['video_link']; ?>?rel=0" frameborder="0" >

                        </iframe>
                    </div>
                </div>
            <?php endif; ?>
            <?php if (Yii::app()->params['comment_facebook'] == 'show'): ?>


                <div class="fb-ctn">
                    <p class="line"></p>

                    <div id="fb-root"></div>
                    <div data-width="<?php echo $datawidth;?>" class="fb-comments fb_iframe_widget" style="margin-left:20px;" data-mobile='<?php echo $datamobile; ?>'  data-href="<?php echo $url; ?>"  data-colorscheme="light"></div>

                </div>
                <script type="text/javascript">

                </script>
            <?php endif; ?>
        </div>
    </div>
    <div class="modal " id="modal-ajax" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content booked-modal">
                <div class="modal-header">

                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/frontend/images/icon_close.png" /></button>
                </div>
                <div class="modal-body booked-modal-body">

                    <!-- <div class="text_info">

                    </div> -->
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<div class="modal modal-seatmap " id="Modalseatmap" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content login-modal">
            <div class="modal-header">
                <button id="close-seatmap" type="button" class="close"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/frontend/images/icon_close.png" /></button>
            </div>
            <div class="modal-body">

                <!-- <div class="text_info">

                </div> -->
            </div>
        </div>
    </div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
<div class="modal " id="modal-map" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content google-map-content">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/frontend/images/icon_close.png" /></button>
            <div class="modal-body">

                <!-- <div class="text_info">

                </div> -->
            </div>
        </div>
    </div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
<script type="text/javascript">
    $(document).one('ajaxComplete', function() {

        history.pushState('', 'wewe', "<?php echo $url; ?>");
       
        setTimeout(function() {
             $('#slides').slidesjs({
            width: '100%',
            pagination: {
                active: false
            },
            play: {
                // active: true,
                auto: true,
                interval: 4000,
                swap: true
            }
        });
            FB.XFBML.parse();
            $(".event-details .view-item").height($(window).height()-140);
            $(window).resize(function(){
                 $(".event-details .view-item").height($(window).height()-140);
                 <?php

                    if (!preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"])) {
                        echo '$(".event-details .view-item").jScrollPane();';

                    }
                    ?>
            });
<?php

if (!preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"])) {
    echo '$(".event-details .view-item").jScrollPane();';
    
}
?>

        }, 200);
        $('a[data-toggle=modal]').on('click', function() {
            $('.ajax-loading-block').removeClass('ajax-loading-block');
        });
        $('.ajax-modal').click(function() {
            $('#modal-ajax').modal('show');
            $('#modal-ajax').find('.modal-content').addClass('ajax-loading-block');
            $request.ajaxData($(this).attr('ref'), '', function(html) {
                $('#modal-ajax .modal-content').removeClass('ajax-loading-block');
                $('#modal-ajax .modal-body').html(html);

            });
        });
        $('.close').click(function() {
            $(this).closest('.modal').modal('hide');
            return false;
        });
        $('.event-details [data-load-remote]').bind('click', function(e) {

            e.preventDefault();
            var $this = $(this);
            var remote = $this.data('load-remote');
            var img = '<div class="loading"><div style="width:134px;height:100px;margin:0 auto;padding-top: 60px;"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/frontend/images/ajaxloader.gif"></div></div>';
            $($this.data('remote-target')).html(img);
            href = $this.attr('href');
            $(href).modal('show');
            $.ajax({
                url: remote,
                type: 'POST',
                success: function(data) {
                    $($this.data('remote-target')).html(data);
					booked();

                }
            });
            return false;
        });

    });
</script>
<div class="thank-you" ref="<?php echo Yii::app()->createAbsoluteUrl("site/thankyou"); ?>"></div>
<?php if (!isset(Yii::app()->session['LOGGED_USER'])): ?>
<?php endif; ?>
<script type="text/javascript">
$(document).ready(function(){
    $("#slides").mouseenter(function(){
      $('.slidesjs-navigation').css("visibility","visible");
  }).mouseleave(function(){
      $('.slidesjs-navigation').css("visibility","hidden");
  });
})
</script>
<style>
    .fancybox-inner{
        overflow: hidden !important;
    }
    .modal-body{
        overflow: hidden;
    }
    .google-map-content
    {
        height: 355px;
    }
    #modal-map{
        z-index: 9999999;
    }
    #modal-map .modal-dialog{
        height: 381px !important;
        margin-top: 20px;
        width: 320px !important;
    }
    #Modal-login .modal-dialog{
        width: 300px;
        height: 300px;
    }
    #Modal-login .modal-dialog h1{
        display: block;
        font-size: 2em;
        -webkit-margin-before: 0.67em;
        -webkit-margin-after: 0.67em;
        -webkit-margin-start: 0px;
        -webkit-margin-end: 0px;
        font-weight: bold;
    }
</style>